/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package servidor_cantador;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author gabriel
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        try {

            ResultSet result = NumPartidas();
            while (result.next()) {
                
                Partida partida = new Partida(""+result.getObject("num_partida"));
                partida.start();

            }
            result.close();
    
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        }

    }

    public static ResultSet NumPartidas(){

         try
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conexion = DriverManager.getConnection("jdbc:mysql://localhost/multimedia", "root","");
            Statement statement = conexion.createStatement();
            ResultSet result = statement.executeQuery("Select * FROM partida");
           
            return(result);
        }
        catch(Exception e){
            System.out.println(e.getMessage());
            return(null);
        }

    }

}
